@extends('users.app')
@section('title', '视频地址列表')
@section('content')
<div class="row">
    <div class="col-12 col-xl-10 m-b-10">
    <div class="card">
        <div class="card-header border-bottom">
            <h4 class="card-title">总视频列表</h4>
        </div>
        <div class="card-body">
            <h4 class="mt-0 box-title"></h4>
            <p class="text-muted m-b-20 box-content">
              <a href="{{ route('videos.create')}}" class="btn btn-common">添加视频</a>
            </p>
            <div class="table-responsive">
                <table class="table table-bordered mb-0">
                    <thead>
                        <tr>
                            <th>编号</th>
                            <th>链接</th>
                            <th>添加时间</th>
                            <th>修改时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($videos as $video)
                        <tr>
                            <th scope="row">{{ $video->id }}</th>
                            <td>{{ $video->link }}</td>
                            <td>{{ $video->created_at->diffForHumans() }}</td>
                            <td>{{ $video->updated_at->diffForHumans() }}</td>
                            <td>
                              <a href="{{ route('videos.edit', $video->id)}}" class="btn btn-sm btn-danger">编辑</a>
                                <form action="{{ route('videos.destroy', $video->id) }}" method="POST" style="display: inline;" onsubmit="return confirm('Delete? Are you sure?');">
                                  {{csrf_field()}}
                                  <input type="hidden" name="_method" value="DELETE">

                                  <button type="submit" class="btn btn-sm btn-danger">删除</button>
                                </form>
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
      </div>
    </div>
</div>
@stop
